home *** CD-ROM | disk | FTP | other *** search
- /* e_gettimeofday.c */
- /* 18Oct95 e -- from runtime.c */
-
- #include <utime.h>
-
- #define TICKS_PER_SEC 60
-
- static unsigned long then, ttks;
-
- void gettimeofday ( struct timeval *t, int huh )
- {
- unsigned long now, ticks;
-
- now = LMGetTime();
- ticks = LMGetTicks();
- ticks = ((ticks % TICKS_PER_SEC) * 1000000) / TICKS_PER_SEC;
- if( now == then && ticks <= ttks )
- { // no or "negative" time has passed
- // make it look like some time has passed, if we can, within the same second
- ticks = ttks + (( ttks < 999999 ) ? 1 : 0);
- }
- then = now;
- t->tv_sec = now;
- ttks = ticks;
- t->tv_usec = ticks;
- }
-
- // end
-